//
//  DoctorDetailsButtonView.m
//  QuickCure1
//
//  Created by summer的Dad on 16/11/1.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "DoctorDetailsButtonView.h"

@implementation DoctorDetailsButtonView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
#pragma mark
#pragma mark - 重写init
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
    }
    return self;
    
}
#pragma mark
#pragma mark - 搭建界面
- (void)setupUI
{
    UIButton* ben1 = [UIButton buttonWithType:0];
    [ben1 setTitle:@"重新申请" forState: UIControlStateNormal];
    [ben1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [ben1 setBackgroundImage:[UIImage imageNamed:@"link_button_02"] forState:UIControlStateNormal];
    CGFloat widthW = (SCREEN_WIDTH / 2) *0.8;
    ben1.tag = 100;
    [self addSubview: ben1];
    [ben1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self).offset(18);
        make.centerY.equalTo(self);
        make.bottom.equalTo(self).offset(-8);
        make.width.mas_equalTo(widthW);
    }];
    [ben1  addTarget:self action:@selector(clickben:) forControlEvents:UIControlEventTouchUpInside];
    
    //第二个
    UIButton* ben2 = [UIButton buttonWithType:0];
    [ben2 setTitle:@"取消预约" forState:UIControlStateNormal];
    [ben2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [ben2 setBackgroundImage:[UIImage imageNamed:@"link_button_02"] forState:UIControlStateNormal];
    ben2.tag = 101;
    [self addSubview:ben2];
    
    [ben2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(self).offset(-18);
        make.centerY.equalTo(self);
        make.bottom.equalTo(self).offset(-8);
        make.width.mas_equalTo(widthW);
    }];
    
     [ben2  addTarget:self action:@selector(clickben:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)clickben:(UIButton*)ben
{
    if (self.clickBlock) {
        _clickBlock(ben.tag);
    }
    
}

@end
